package hcn.protocol.ods.report;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import java.io.Serializable;
import java.util.List;

/**
 * Created by jinxin on 2016/5/18.
 */
@XmlRootElement(name = "labReport")
public class LabReportBean extends ReportBean implements Serializable {

    private static final long serialVersionUID = 6424449463447868601L;

    private String labType;                         //检验项目类型
    private String labName;                         //检验项目名称
    private String labSampleName;                   //检验样本名称
    private String diagnoseDesc;                    //诊断描述
    private String reportViewType;                  //报告展示类别
    private ConventionalReportBean conventionalReport;  //常规报告
    private MicrobiologyReportBean microbiologyReport;   //微生物报告

    public String getLabType() {
        return labType;
    }

    public void setLabType(String labType) {
        this.labType = labType;
    }

    public String getLabName() {
        if(labName==null){
            labName = labSampleName;
        }
        return labName;
    }

    public void setLabName(String labName) {
        this.labName = labName;
    }

    public String getLabSampleName() {
        return labSampleName;
    }

    public void setLabSampleName(String labSampleName) {
        this.labSampleName = labSampleName;
        if(labSampleName!=null && !"".equals(labSampleName.trim()) && (labName == null || (labName!=null && "".equals(labName.trim())))) {
            setLabName(labSampleName);
        }
    }

    public String getDiagnoseDesc() {
        return diagnoseDesc;
    }

    public void setDiagnoseDesc(String diagnoseDesc) {
        this.diagnoseDesc = diagnoseDesc;
    }

    public String getReportViewType() {
        reportViewType = "01";
        if (microbiologyReport != null)
            reportViewType = "02";
        return reportViewType;
    }

    public void setReportViewType(String reportViewType) {
        this.reportViewType = reportViewType;
    }

    public ConventionalReportBean getConventionalReport() {
        return conventionalReport;
    }

    public void setConventionalReport(ConventionalReportBean conventionalReport) {
        this.conventionalReport = conventionalReport;
    }

    public MicrobiologyReportBean getMicrobiologyReport() {
        return microbiologyReport;
    }

    public void setMicrobiologyReport(MicrobiologyReportBean microbiologyReport) {
        this.microbiologyReport = microbiologyReport;
    }

    @XmlTransient
    @JsonIgnore
    public List<LabCommonDetailBean> getDetails() {
        if (conventionalReport == null) {
            return null;
        }
        return conventionalReport.getDetails();
    }

    public void setDetails(List<LabCommonDetailBean> details) {
        if (conventionalReport == null) {
            conventionalReport = new ConventionalReportBean();
        }
        conventionalReport.setDetails(details);
    }

    public void setPlantDetails(List<LabPlantDetailBean> plantDetails) {
        if (microbiologyReport == null) {
            microbiologyReport = new MicrobiologyReportBean();
        }
        microbiologyReport.setPlantDetails(plantDetails);
    }

    public List<LabPlantDetailBean> getPlantDetails() {
        if (microbiologyReport == null) {
            return null;
        }
        return microbiologyReport.getPlantDetails();
    }

    public void setBioDetails(List<LabBioDetailBean> bioDetails) {
        if (microbiologyReport == null) {
            microbiologyReport = new MicrobiologyReportBean();
        }
        microbiologyReport.setBioDetails(bioDetails);
    }

    public List<LabBioDetailBean> getBioDetails() {
        if (microbiologyReport == null) {
            return null;
        }
        return microbiologyReport.getBioDetails();
    }
}
